<template>
  <div>
    <!-- 信用分下限编辑dialog-->
    <el-dialog
      :title="title"
      width="570px"
      :close-on-click-modal="false"
      v-dialogDrag
      :visible.sync="editVisible"
    >
      <el-form
        label-width="105px"
        :rules="dataRule"
        ref="editForm"
        :model="editForm"
      >
        <el-form-item label="信用分下限:" prop="score">
          <el-input v-model="queryForm.truckCreditDeduct" v-thousands.truckCreditDeduct="queryForm"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" type="primary" @click="doSubmit()" v-noMoreClick
          >保存</el-button
        >
        <el-button size="small" @click="close()">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { edit } from '@/api/sys/setting/setting.js'
export default {
  components: {},
  data () {
    return {
      method: '',
      title: '',
      editForm: {
        rule: 0,
        score: 0
      },
      queryForm:{
        truckCreditDeduct: ''
      },
      
      editVisible: false,
      detailsVisible: false,
      dataRule: {
      }
    }
  },
  methods: {
  	handleClose(done) {
		this.$Msg.confirm({
			title:'您确定要关闭吗？',
			content:this.GLOBAL.FORM_CLOSE_TIPS,
			confirmCall:()=>{
				done();
			}
		})
	},
    init (method, editForm) {
      if (method === 'edit') {
        this.editVisible = true
        this.method = method
        this.$nextTick(() => {
          this.$refs.editForm.clearValidate()
          this.queryForm.truckCreditDeduct = editForm
        })

        this.title = '信用分下限设置'
      }
    },
    close () {
      this.editForm = {}
      this.editVisible = false
    },
    doSubmit () {
      edit({
        codes: '200009',
        svalue: this.queryForm.truckCreditDeduct,
        props: 1
      }).then(({data}) => {
        if (data.code === 200) {
          this.$message({
            message: '编辑成功',
            type: 'success'
          })
          this.$varUtils.refreshVarList().then((res) => {
            this.$emit('refreshDataList')
          })
        }
        this.editVisible = false
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.view-container {
  margin-bottom: 20px;
  display: flex;
  .label-container {
    width: 150px;
    text-align: right;
    font-size: 16px;
    font-weight: 400;
    color: #666666;
  }
  .form-container {
    font-size: 14px;
    font-weight: 400;
    color: #333333;
    width: 200px;
  }
}
</style>
